package com.xyj.singleton;

/**
 * 懒汉模式
 */
public class LazySingleTon {

    private LazySingleTon(){}

    public static volatile LazySingleTon instance=null;

    public static LazySingleTon getInstance(){
        if (instance==null){
            synchronized (LazySingleTon.class){
                if (instance==null){
                    instance=new LazySingleTon();
                }
            }
        }
        return instance;
    }
}
